<?php

class Admin_AboutcountryController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
       	$this->_helper->layout()->disableLayout();
		Zend_Loader::loadFile('../application/admin/models/Aboutcountry.php');

		$aboutcountry_model = new Aboutcountry();
		$rec_arr = $aboutcountry_model->listPageContentAboutCountry();
		$this->view->rec_arr = $rec_arr;	
    }

    public function addAction()
    {
    	$this->_helper->layout()->disableLayout();
    	Zend_Loader::loadFile('../application/admin/forms/Aboutcountry.php');
		$aboutcountry_form = new Form_Aboutcountry();
        $this->view->title = "About Sri Lanka -  Add Details";
        $this->view->aboutsl_form = $aboutcountry_form;
    }
    
    public function doaddaboutcountryAction()
    {
    	$this->_helper->layout()->disableLayout();
    	Zend_Loader::loadFile('../application/admin/forms/Aboutcountry.php');
		Zend_Loader::loadFile('../application/admin/models/Aboutcountry.php');
		$aboutcountry_form = new Form_Aboutcountry();
		$request = $this->getRequest();
		
		if ($this->getRequest()->isPost()) {            
			$aboutcountry_model = new Aboutcountry();
			$form_values = $request->getPost();
			$add_page_about = $aboutcountry_model->addPage($form_values);
		}
		
		exit;
    }
    
    public function editAction()
    {
    	$this->_helper->layout()->disableLayout();
        Zend_Loader::loadFile('../application/admin/forms/Aboutcountry.php');
		Zend_Loader::loadFile('../application/admin/models/Aboutcountry.php');
		$aboutcountry_form = new Form_Aboutcountry();
		$mod_abtcountry = new Aboutcountry();
        $controller = $this->getRequest()->getControllerName();
		$action = $this->getRequest()->getActionName();
		$page_id = $this->_getParam('page_id', 0);
		$options = array("action"=>$action);        

        $this->view->page_id = $page_id;
        $aboutcountry_arr = $mod_abtcountry->getPageDetailsById($page_id);
        $this->view->aboutcountry_arr = $aboutcountry_arr;
    }
    
    public function doupdateaboutcountryAction()
    {
        $this->_helper->layout()->disableLayout();
   		Zend_Loader::loadFile('../application/admin/models/Aboutcountry.php');
		Zend_Loader::loadFile('../application/admin/forms/Aboutcountry.php');
        $aboutcountry_form = new Form_Aboutcountry();
		
        $request = $this->getRequest();
		if ($this->getRequest()->isPost()) {            
			$mod_abtcountry = new Aboutcountry();
			$form_values = $request->getPost();
			$update_abtcountry = $mod_abtcountry->updatePage($form_values);
		}
		
		exit;
    }
    
    public function viewAction()
    {
    	$this->_helper->layout()->disableLayout();
   		Zend_Loader::loadFile('../application/admin/models/Aboutcountry.php');
		
   		$mod_abtcountry = new Aboutcountry();
   		$request = $this->getRequest();
   		$page_id = $request->getParam('page_id', 0);
   		
   		$rec_arr = $mod_abtcountry->getPageDetailsById($page_id);
   		$this->view->rec_arr = $rec_arr;   			
    }
    
    public function deleteAction()
    {
        $this->_helper->layout()->disableLayout();
        $page_id = $this->_getParam('page_id', 0);    
        Zend_Loader::loadFile('../application/admin/models/Aboutcountry.php');
        $mod_abtcountry = new Aboutcountry();
        $mod_abtcountry->deletePageData($page_id);
        //$this->_helper->redirector('index');
        exit;
    }
}